背景版本控制信息:
Python:3.8.1
Ubuntu:18.04.4
我正在尝试通过pip下载const GoogleStrategy = require('passport-google-oauth20').Strategy
const passport = require('passport');
const User = require('../models/user');
passport.serializeUser((user, done) => {
done(null, user.id)
})
passport.deserializeUser((id, done) => {
User.findById(id, (err, user) => done(err, user))
})
passport.use(
new GoogleStrategy(
{
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: '/auth/google/callback',
proxy: true
},
async (accessToken, refreshToken, profile, done) => {
const newUser = {
googleId: profile.id,
displayName: profile.displayName,
firstName: profile.name.givenName,
lastName: profile.name.familyName,
image: profile.photos[0].value,
}
try {
let user = await User.findOne({ googleId: profile.id })
if (user) {
done(null, user)
} else {
user = await User.create(newUser)
done(null, user)
}
} catch (err) {
console.error(err)
}
}
)
)
软件包:
psycopg2
但是,这将导致以下错误:
pip3 install psycopg2
关注ModuleNotFound错误:我看到其他一些文章建议安装File "<string>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
from setuptools.dist import Distribution, Feature
File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
from setuptools import windows_support
File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
软件包,
而我做到了:
libffi-dev
具有以下输出:
sudo apt-get install libffi-dev
在安装libffi-dev is already the newest version (3.2.1-8).
之后,我还重新安装了Python。
然后,重新运行apt-get install --reinstall Python3
命令仍然返回与我上面提到的相同的错误。我已经通过
pip3 install psycopg2
psycopg2-binary
但是我仍然需要下载基本的pip3 install psycopg2-binary
软件包。安装程序中还缺少什么?