服务器:Ubuntu 16.04.4 LTS
当前Python版本:3.5.2
待升级Python版本:3.8.x
项目框架:Django2.0.9
问题1:uwsgi
虚拟环境创建完成,但是在pip安装的时候遇到了第一个问题,uwsgi安装报错。
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Collecting uWSGI Using cached http://mirrors.aliyun.com/pypi/packages/24/fd/93851e4a076719199868d4c918cc93a52742e68370188c1c570a6e42a54f/uwsgi-2.0.20.tar.gz (804 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: uWSGI Building wheel for uWSGI (setup.py) ... error ERROR: Command errored out with exit status 1: command: /var/www/xxxx_service/venv/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zsha325q/uwsgi_51aeb00d5183497a974b06a81f9c2458/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zsha325q/uwsgi_51aeb00d5183497a974b06a81f9c2458/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ptbf967q cwd: /tmp/pip-install-zsha325q/uwsgi_51aeb00d5183497a974b06a81f9c2458/ Complete output (181 lines): /usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'descriptions' ...... ...... ...... collect2: error: ld returned 1 exit status *** error linking uWSGI *** ---------------------------------------- ERROR: Command errored out with exit status 1: /var/www/xxxx_service/venv/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zsha325q/uwsgi_51aeb00d5183497a974b06a81f9c2458/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zsha325q/uwsgi_51aeb00d5183497a974b06a81f9c2458/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-e0wfuy2_/install-record.txt --single-version-externally-managed --compile --install-headers /var/www/xxxx_service/venv/include/site/python3.8/uWSGI Check the logs for full command output.
问题1解决方案
方案一,Ubuntu安装uWSGI失败处理,失败
apt-get install libpython3.8-dev
方案二,失败
apt-get install build-essential libssl-dev libffi-dev python-dev
方案三,成功,放弃
uwsgi
,改用pyuwsgi
。虽然这个成功了 但是个人不建议使用,毕竟改变了项目原来的库,哪位大佬有更好的解决方案麻烦分享一下,不胜感谢。pip install pyuwsgi
问题2:celery
celery报错
/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/platforms.py:797: RuntimeWarning: You're running the worker with superuser privileges: this is absolutely not recommended! Please specify a different user using the --uid option. User information: uid=0 euid=0 gid=0 egid=0 warnings.warn(RuntimeWarning(ROOT_DISCOURAGED.format( Traceback (most recent call last): File "/var/www/xxxx_service/venv/bin/celery", line 8, in <module> sys.exit(main()) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/__main__.py", line 15, in main sys.exit(_main()) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/bin/celery.py", line 150, in main return celery(auto_envvar_prefix="CELERY") File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/bin/worker.py", line 323, in worker worker = app.Worker( File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/worker/worker.py", line 99, in __init__ self.setup_instance(**self.prepare_args(**kwargs)) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/worker/worker.py", line 139, in setup_instance self.blueprint.apply(self, **kwargs) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/bootsteps.py", line 211, in apply step.include(parent) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/bootsteps.py", line 339, in include return self._should_include(parent)[0] File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/bootsteps.py", line 335, in _should_include return True, self.create(parent) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/worker/components.py", line 211, in create w._persistence = w.state.Persistent(w.state, w.statedb, w.app.clock) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/worker/state.py", line 189, in __init__ self.merge() File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/worker/state.py", line 197, in merge self._merge_with(self.db) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/kombu/utils/objects.py", line 29, in __get__ return super().__get__(instance, owner) File "/usr/lib/python3.8/functools.py", line 967, in __get__ val = self.func(instance) File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/worker/state.py", line 266, in db return self.open() File "/mnt/var/www/xxxx_service/venv/lib/python3.8/site-packages/celery/worker/state.py", line 192, in open return self.storage.open( File "/usr/lib/python3.8/shelve.py", line 243, in open return DbfilenameShelf(filename, flag, protocol, writeback) File "/usr/lib/python3.8/shelve.py", line 227, in __init__ Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback) File "/usr/lib/python3.8/dbm/__init__.py", line 91, in open raise error[0]("db type is {0}, but the module is not " dbm.error: db type is dbm.gnu, but the module is not available
问题2解决方案
apt-get install python3.8-gdbm
问题3:Crypto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/Signature/PKCS1_v1_5.py", line 112, in sign
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 174, in decrypt
return result
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/PublicKey/pubkey.py", line 93, in decrypt
plaintext=self._decrypt(ciphertext)
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 235, in _decrypt
- *'PEM'*. (*Default*) Text encoding, done according to `RFC1421`_/`RFC1423`_.
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/Util/number.py", line 123, in getRandomRange
return y
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/Util/number.py", line 104, in getRandomInteger
If :data:`randfunc` is omitted, then :meth:`Random.get_random_bytes` is used.
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
return self._singleton.read(bytes)
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
return _UserFriendlyRNG.read(self, bytes)
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read
self._ec.collect()
File "/var/www/xxxx_service/venv3.8/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect
t = time.clock()
AttributeError: module 'time' has no attribute 'clock'
问题3解决方案
crypto
已经停更了,需要安装pycryptodome
pip install pycryptodome